package pres.lnk.learn.designpattern.p_interpreter.impl;

import pres.lnk.learn.designpattern.p_interpreter.Expression;

/**
 * @Author lnk
 * @Date 2018/5/4
 */
public class AndExpression implements Expression {
    private Expression[] exprs;

    public AndExpression(Expression... exprs) {
        this.exprs = exprs;
    }

    @Override
    public boolean interpret(String context) {
        for (Expression expr : exprs) {
            if(!expr.interpret(context)){
                return false;
            }
        }
        return true;
    }
}
